package cn.player.adapter;

import android.content.Context;
import android.widget.ImageView;
import android.widget.TextView;

import net.tsz.afinal.FinalBitmap;

import java.util.List;

import cn.player.App;
import cn.player.R;
import cn.player.entity.RecomInfo;
import cn.player.media.adapter.BaseAdpt;

/**
 * 右侧推荐信息adpater
 *
 * @author zengliang
 */
public class RightRecomInfoAdapter extends BaseAdpt<RecomInfo> {


    private App app;
    private FinalBitmap finalBitamp;

    public RightRecomInfoAdapter(Context mContext, List<RecomInfo> mData, int layoutResource) {
        super(mContext, mData, layoutResource);
        // TODO Auto-generated constructor stub
        app = (App) mContext.getApplicationContext();
        finalBitamp = app.getFinalBitmap();
    }

    @Override
    protected void addViewId() {
        // TODO Auto-generated method stub
        mViewIds.add(R.id.iv_right_recom_img);
        mViewIds.add(R.id.tv_right_recom_title);
    }

    @Override
    protected void updateItemViews(int position) {
        // TODO Auto-generated method stub
        ImageView iv_recom_img = (ImageView) viewHolder.getView(R.id.iv_right_recom_img);
        TextView tv_recom_title = (TextView) viewHolder.getView(R.id.tv_right_recom_title);

        tv_recom_title.setText(mData.get(position).getName());
        finalBitamp.display(iv_recom_img, mData.get(position).getImg());
    }

}
